import http from '@/http';
import type {ImageType, ResponseData} from '@/types/interface';


const imageApi = {
    // 上传图片（通用）
    uploadImage: (filePath: string, type: ImageType): Promise<ResponseData<{ imageUrl: string }>> => {
        return http.upload('/image/upload', {
            filePath,
            name: 'image',
            formData: { type }
        });
    },

    // 获取目标对象的图片列表
    getTargetImages: (targetId: number, type: ImageType): Promise<ResponseData<{ imageUrls: string[] }>> => {
        return http.get(`/image/list?targetId=${targetId}&type=${type}`);
    }
};

export default imageApi;